package com.dd.cloud.user.mapper.phar;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dd.cloud.user.entity.phar.Pharmacy;
import com.dd.cloud.user.req.phar.PharmacyHomeChartStatisticsReq;
import com.dd.cloud.user.req.phar.PharmacyPageReq;
import com.dd.cloud.user.res.phar.PharmacyHomeChartStatisticsListRes;
import com.dd.cloud.user.res.phar.PharmacyHomeDrugDosageStatisticsRes;
import com.dd.cloud.user.res.phar.PharmacyHomeTopStatisticsRes;
import com.dd.cloud.user.res.phar.PharmacyMechanSelectRes;
import com.dd.cloud.user.res.phar.PharmacyPageRes;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 药房表 Mapper 接口
 * </p>
 *
 * @author czg
 * @since 2022-09-23
 */
public interface PharmacyMapper extends BaseMapper<Pharmacy> {
    /**
     * 统计药房首页头部数据
     *
     * @param pharmacyId
     * @return
     */
    PharmacyHomeTopStatisticsRes statisticsPharmacyHomeTop(@Param("pharmacyId") Integer pharmacyId);

    /**
     * 统计药房首页近期收入情况数据列表
     *
     * @param req
     * @return
     */
    List<PharmacyHomeChartStatisticsListRes> statisticsListPharmacyHomeChartList(@Param("req") PharmacyHomeChartStatisticsReq req);

    /**
     * 统计药房首页近期收入情况数据总收入
     *
     * @param req
     * @return
     */
    Integer statisticsListPharmacyHomeCharTotalIncome(@Param("req") PharmacyHomeChartStatisticsReq req);

    /**
     * 统计药房首页药品总用量排行榜
     *
     * @param pharmacyId
     * @return
     */
    List<PharmacyHomeDrugDosageStatisticsRes> statisticsPharmacyHomeDrugDosage(@Param("pharmacyId") Integer pharmacyId);

    /**
     * 查询药房可查询的机构 下拉框使用
     *
     * @param pharmacyId
     * @return
     */
    List<PharmacyMechanSelectRes> queryPharmacyMechanSelect(@Param("pharmacyId") Integer pharmacyId);

    /**
     * 查询药房开始收入时间
     *
     * @param pharmacyId
     * @return
     */
    LocalDateTime queryFirstPharmacyIncomeDate(@Param("pharmacyId") Integer pharmacyId);

    /**
     * 分页查询药房数据
     */
    Page<PharmacyPageRes> getPharmacyPage(Page<PharmacyPageRes> page, PharmacyPageReq req);
}
